package com.situ.mall.common.mapper;

import com.situ.mall.common.entity.Attachment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 闫佳宁
 * @since 2023-09-13
 */
public interface AttachmentMapper extends BaseMapper<Attachment> {

    int bind(@Param("ids") String[] split, @Param("id") Integer id, @Param("source") String source);

    @Select("SELECT * FROM attachment where source_id = {sourceId}")
    Attachment select1(Integer sourceId);

    @Delete("DELETE FROM attachment WHERE source_id IS NULL or source IS NULL")
    void clean();
}
